Repository navigation
Keep the case of short flags in PNG filenames - #1317
Open
farisbasha wants to merge 1 commit into
Open
farisbasha wants to merge 1 commit into
farisbasha wants to merge 1 commit into
Conversation
ParseOptionsInFilename lowercased the whole PNG filename before splitting out the options, so case-sensitive short flags changed meaning: Q (no-city) became q (no-caption), T (no-terminal) became t (transparency), M lost m/s wind, and F, I and A were rejected as unknown options. Paris_0pqQ.png failed with "option has multiple values: q". The Python parse_wttrin_png_name kept their case. Keep the case of the flag parts and lowercase only the location, dimensions and key=value options, as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ParseOptionsInFilenamelowercases the whole PNG filename before it splits out the options. Short flags are case-sensitive, so the uppercase ones change meaning or make the request fail. The function's own doc comment saysRome_0pq_lang=it_T.pnggivesno-terminal=true, but today theTturns intot(transparency).Repro on the live site:
Qq)Tt)MF,I,Aunknown option: f/i/a, HTTP 500The Python
parse_wttrin_png_name(removed in 168c304) kept the case of these parts, and the query-string form (?0pqQ) still works.Fix: strip the
.png/.PNGsuffix without lowercasing the rest. The location, the dimension parts and thekey=valueparts are still lowercased, soOymyakon,300XandLANG=DEbehave as before. Only the short-flag bundles keep their case.Tests (Go 1.27 on Linux, after
bash build.sh assets):TestCaseSensitiveFlagsInFilename. It checksParseOptionsInFilenamewith.pngand.PNGnames, and a fullParseof a/Oymyakon_0pqQ_T_F.pngrequest. It fails before this change ("option has multiple values: q") and passes after.go test ./...andgo vet ./internal/query/pass.This PR was prepared with AI assistance (Claude).